import request from "../utils/request.js";

  export function createOrder (data) {  //生成订单
  	return request({
  		url:'/api/v1/orders',
  		data,
		method:'POST'
  	})
  }
  
  export function orderList (params) {  //订单列表
  	return request({
  		url:'/api/v1/orders?page=' + params.page + '&per_page=' + params.per_page + '&status=' + params.status,
  		// data
  	})
  }
  
  export function orderDetail(data) {  //订单详情
  	return request({
  		url:'/api/v1/orders/' + data,
  		data
  	})
  } 
  
  export function received (data) {  //订单签收
  	return request({
  		url:`/api/v1/orders/${data}/received`,
  		data, 
  		method:'POST'
  	})
  }
  
  export function refund (data,params) {  //退款
  	return request({
  		url:`/api/v1/orders/${params}/apply_refund`,
  		data, 
  		method:'POST'
  	})
  }
  
  export function postreview (data,params) {  //订单评价
  	return request({
  		url:`/api/v1/orders/${params}/review`,
  		data,
  		method:'POST'
  	})
  }
  
  export function wechatpay (data) {  //微信支付
  	return request({
  		url:`/api/v1/payment/${data}/wechat`,
  		data,
  	})
  }
  export function coupons(data) {  //检查优惠券
  	return request({
  		url:'/api/v1/coupon_codes/' + data,
  		data
  	})
  } 
  